package com.kyle.silverbullet.utils;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Simple to Introduction
 *
 * @author [Kyle]
 * @version [1.0]
 * @since [2018-08-16 13:22]
 * @date [2018-08-16 13:22]
 *
 */
@JsonIgnoreProperties({"stackTrace"})
public class ResultException extends RuntimeException {
    private final ResultEnum resultEnum;

    public ResultException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.resultEnum = resultEnum;
    }

    public ResultException(ResultEnum resultEnum, Throwable throwable) {
        super(resultEnum.getMsg(), throwable);
        this.resultEnum = resultEnum;
    }

    public ResultException(String message, Throwable parent) {
        super(message, parent);
        this.resultEnum = ResultEnum.UNKNOWN_ERROR;
    }

    public ResultException(String message) {
        super(message);
        this.resultEnum = ResultEnum.UNKNOWN_ERROR;
    }

    public ResultException(Throwable t) {
        super(t);
        this.resultEnum = ResultEnum.UNKNOWN_ERROR;
    }

    public ResultEnum getResultEnum() {
        return resultEnum;
    }
}
